<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
          "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>QUnit for X509CRL parser class 'x509crl.js'</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<script type="text/javascript" src="jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="qunit.js"></script>
<link rel="stylesheet" href="qunit.css" type="text/css" media="screen" />

<script src="../ext/cj/cryptojs-312-core-fix.js"></script>
<script src="../ext/cj/x64-core.js"></script>
<script src="../ext/cj/cipher-core_min.js"></script>
<script src="../ext/cj/aes_min.js"></script>
<script src="../ext/cj/tripledes_min.js"></script>
<script src="../ext/cj/enc-base64_min.js"></script>
<script src="../ext/cj/md5_min.js"></script>
<script src="../ext/cj/sha1_min.js"></script>
<script src="../ext/cj/sha256_min.js"></script>
<script src="../ext/cj/sha224_min.js"></script>
<script src="../ext/cj/sha512_min.js"></script>
<script src="../ext/cj/sha384_min.js"></script>
<script src="../ext/cj/ripemd160_min.js"></script>
<script src="../ext/cj/hmac_min.js"></script>
<script src="../ext/cj/pbkdf2_min.js"></script>

<script src="../ext/yahoo.js"></script>
<script src="../ext/jsbn.js"></script>
<script src="../ext/jsbn2.js"></script>
<script src="../ext/prng4.js"></script>
<script src="../ext/rng.js"></script>
<script src="../ext/rsa.js"></script>
<script src="../ext/rsa2.js"></script>
<script src="../ext/base64.js"></script>
<script src="../ext/ec.js"></script>
<script src="../ext/ec-patch.js"></script>

<script src="../src/crypto-1.1.js"></script>
<script src="../src/asn1hex-1.1.js"></script>
<script src="../src/rsapem-1.1.js"></script>
<script src="../src/rsasign-1.2.js"></script>
<script src="../src/x509-1.1.js"></script>
<script src="../src/asn1-1.0.js"></script>
<script src="../src/asn1x509-1.0.js"></script>
<script src="../src/base64x-1.1.js"></script>
<script src="../src/keyutil-1.0.js"></script>
<script src="../src/dsa-2.0.js"></script>
<script src="../src/ecdsa-modified-1.0.js"></script>
<script src="../src/ecparam-1.0.js"></script>
<script src="../src/x509crl.js"></script>

<script type="text/javascript">
$(document).ready(function(){

// **** TEST **********

// DigiCert Global Root CRL
// 0cert_sites/digicertglobalrootca.crl.529 2020.08.20
var pemCRLDigiCert = (function() {/*
-----BEGIN X509 CRL-----
MIICczCCAVsCAQEwDQYJKoZIhvcNAQELBQAwYTELMAkGA1UEBhMCVVMxFTATBgNV
BAoTDERpZ2lDZXJ0IEluYzEZMBcGA1UECxMQd3d3LmRpZ2ljZXJ0LmNvbTEgMB4G
A1UEAxMXRGlnaUNlcnQgR2xvYmFsIFJvb3QgQ0EXDTIwMDgyMDIxMjQzNFoXDTIw
MDkxMDIxMjQzNFowgZMwLwIQEj3PhK5IQbSvpzHmKQQqyBcNMDYxMTEwMDAwMDAw
WjAMMAoGA1UdFQQDCgEEMC8CECqEb7Dqwkryl1QKwOpjTggXDTA2MTExMDAwMDAw
MFowDDAKBgNVHRUEAwoBBDAvAhAPFoNPgpGR4yr/eyk5t5pSFw0yMDA2MTIwNTMw
MDBaMAwwCgYDVR0VBAMKAQCgMDAuMB8GA1UdIwQYMBaAFAPeUDVW0Uy7ZvCj4hsb
w5eyPdFVMAsGA1UdFAQEAgICETANBgkqhkiG9w0BAQsFAAOCAQEAPF7ozoGa3a0a
4lvKs4s8krI3kHhlUt8SPs0agnd7QJXcaooorLo4gynl5pZKVrFq7qknFAq6Hp5C
XynUxvbaIxXNtDPO1R29R2Ec6jQHFTQb6HyAxXjhS8nomkUQ4ls2mYaPuUldb6my
evr/uYi8JN0kc771j6NWLWI/KHshQqYPmVPA2AMTr483bUj84w9j3qIKmoH9LfY/
YXcRRUzSYF2siy/atyZIc7ZHhWsUOTP8kHQ5jXIK+4XPWfsOqJUA4B4UWkn2kjhF
J8Djii8M/GJL6ExABeBy8XFZho/ldPJv5JhQZj5wg7ql2bL9OklCvkMDDWXOVhFj
ednzx9cEdg==
-----END X509 CRL-----
*/}).toString().match(/\/\*([^]*)\*\//)[1];

// 0cert_sites/digicertglobalrootca.cer > pubkey
var pemPubDigiCert = (function() {/*
-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4jvhEXLeqKTTo1eqUKKP
C3eQyaKl7hLOllsBCSDMAZOnTjC3U/dDxGkAV53ijSLdhwZAAIEJzs4bg7/fzTtx
RuLWZscFs3YnFo97nh6Vfe63SKMI2tavegw5BmV/Sl0fvBf4q77uKNd0f3p4mVmF
aG5cIzJLv07A6Fpt43C/dxC//AH2hdmoRBBYMql1GNXRor5H4idq9Joz+EkIYIvU
X7Q6hL+hqkpMfT7PT19sdl6gSzeRntwi5m3OFBqOasv+zbMUZBfHWymeMr/y7vrT
C0LUq7dBMtoM1O/4gdW7jVg/tRvoSSiicNoxBN33shbyTApOB6jtSj1etX+jkMOv
JwIDAQAB
-----END PUBLIC KEY-----
*/}).toString().match(/\/\*([^]*)\*\//)[1];

// 0cert_sites/github.com.cer > pubkey
var pemPubGitHub = (function() {/*
-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsdTcPK/9807twWet5ssi
6Lfiqyjy99xicAjRDK/WFmohsDZLFw02YwSuv+ogUZVlZvK/uU2kDCnr9RWx6DWz
cBCU1RtZtCYP1oNXWZ3hfAnd4BPKTW9Dm83PhzoVp4XdZoPtkwz+K204HHmIkM+t
WBgtUdHCo/JHjG84Cbm470yTC8uDlIfq4KO12Xubaw9D+crugA0op3bxJfTBNTz2
dK3eajOCe9z9S3anwu7yar+pJKZf5y58DtvDdHP6fsbYz2DrNlYhtsGKuCSCTXgk
uukdoYqnh75mJWm/vjtybk/g5IUlCLGRibjWdGV2myxPYh+h+jq+nCS/n8qwxcBn
jQIDAQAB
-----END PUBLIC KEY-----
*/}).toString().match(/\/\*([^]*)\*\//)[1];

test("getParam test (digicert global root)", function() {
var hExpect = {
 version: 2,
 sigalg: "SHA256withRSA",
 issuer: {
  array: [
   [{type:"C",value:"US",ds:"prn"}],
   [{type:"O",value:"DigiCert Inc",ds:"prn"}],
   [{type:"OU",value:"www.digicert.com",ds:"prn"}],
   [{type:"CN",value:"DigiCert Global Root CA",ds:"prn"}]
  ]
 },
 thisupdate: "200820212434Z",
 nextupdate: "200910212434Z",
 revcert: [
  {sn:{hex:"123dcf84ae4841b4afa731e629042ac8"},
   date:"061110000000Z",
   ext:[{extname:"cRLReason",code:4}]},
  {sn:{hex:"2a846fb0eac24af297540ac0ea634e08"},
   date:"061110000000Z",
   ext:[{extname:"cRLReason",code:4}]},
  {sn:{hex:"0f16834f829191e32aff7b2939b79a52"},
   date:"200612053000Z",
   ext:[{extname:"cRLReason",code:0}]}
 ],
 ext: [
  {extname: "authorityKeyIdentifier",
   kid: {hex: "03de503556d14cbb66f0a3e21b1bc397b23dd155"}},
  {extname: "cRLNumber", num: {hex: "0211"}}
 ],
 sighex: "3c5ee8ce819addad1ae25bcab38b3c92b23790786552df123ecd1a82777b4095dc6a8a28acba388329e5e6964a56b16aeea927140aba1e9e425f29d4c6f6da2315cdb433ced51dbd47611cea340715341be87c80c578e14bc9e89a4510e25b3699868fb9495d6fa9b27afaffb988bc24dd2473bef58fa3562d623f287b2142a60f9953c0d80313af8f376d48fce30f63dea20a9a81fd2df63f617711454cd2605dac8b2fdab7264873b647856b143933fc9074398d720afb85cf59fb0ea89500e01e145a49f692384527c0e38a2f0cfc624be84c4005e072f17159868fe574f26fe49850663e7083baa5d9b2fd3a4942be43030d65ce56116379d9f3c7d70476"
};

var crl = new X509CRL(pemCRLDigiCert);
equal(crl.posSigAlg, 1, "posSigAlg=1");
equal(crl.posRevCert, 5, "posRevCert=5");
deepEqual(crl.getParam(), hExpect, "param");
});

test("X509CRL.verifySignature test (digicert global root crl)", function() {
var crl = new X509CRL(pemCRLDigiCert);
equal(crl.verifySignature(pemPubDigiCert), true, "verify=true digicert");
equal(crl.verifySignature(pemPubGitHub), false, "verify=false github");
});

});
</script>
  
</head>
<body>
<div id="qunit"></div>
<div id="qunit-fixture">test markup</div>

<p>
<a href="../">TOP</a> | 
<a href="index.html">TEST INDEX</a> | 
<a href="qunit-do-x509.html">x509</a> | 
<a href="qunit-do-x509-ext.html">x509-ext</a> | 
<a href="qunit-do-x509-param.html">x509-param</a> | 
<a href="qunit-do-x509-key.html">x509-key</a> | 
<a href="qunit-do-x509-kid.html">x509-kid</a> | 
<a href="qunit-do-x509-getinfo.html">x509-getinfo</a> | 
<a href="qunit-do-x509-v1.html">x509-v1</a> | 
</p>

</body>
</html>

